﻿using ProjScan.RecordManager;
using ProjScan.RecordManager.AssetData;
using ProjScan.ScanRule.Attr;

namespace ProjScan.ScanRule.ProjectAssets.Mesh
{
    [MeshRuleAttr]
    internal class Mesh_OptimizeMesh : RecordRuleImp<MeshGeometryAssetData, MeshGeometryRecordManager>
    {
        protected override bool IsOK(MeshGeometryAssetData assetData)
        {
            if (assetData.optimizeMesh != null)
            {
                return (bool)assetData.optimizeMesh;
            }

            object optimizeMeshPolygons = assetData.optimizeMeshPolygons;
            bool flag = default(bool);
            bool flag2 = default(bool);
            int num;
            if (optimizeMeshPolygons is bool)
            {
                flag = (bool)optimizeMeshPolygons;
                optimizeMeshPolygons = assetData.optimizeMeshVertices;
                if (optimizeMeshPolygons is bool)
                {
                    flag2 = (bool)optimizeMeshPolygons;
                    num = 1;
                }
                else
                {
                    num = 0;
                }
            }
            else
            {
                num = 0;
            }

            if (num != 0)
            {
                return flag && flag2;
            }

            return true;
        }
    }
}